<form id="grid_form" method="post" style="clear:both;" setting="{ajax:false}">
<?php if(count($this->areas) > 1):?>
<?php
$currentTabIndex = 0;
for($i = 0; $i < count($this->areas); $i++):
	if($this->areas[$i]->getId() == $this->currentAreaId){
		$currentTabIndex = $i;
		break;
	}
endfor;
?>
<script language="javascript" type="text/javascript">
$(function(){
	$('#area_tabs').tabs({
		selected: <?php echo $currentTabIndex; ?>
	});
});
</script>
<div id="area_tabs">
<ul>
<?php foreach($this->areas as $index=>$area):?>
<li><a href="#<?php echo 'area_'.$index?>" onclick="javascript:location.href='<?php echo $this->getUrl(array('areaid'=>$area->getId()))?>'"><?php echo $area->getName(); ?></a></li>
<?php
endforeach;
?>
</ul>
<?php
foreach($this->areas as $index=>$area):
	if($area->getId() == $this->currentAreaId):
?>
<div id="area_<?php echo $currentTabIndex?>">
<?php
echo $this->toolbar->toHtml();
echo $this->grid->toHtml();
?>
</div>
<?php else:?>
<div id="area_<?php echo $index ?>"></div>
<?php endif;
endforeach;
?>
</div>
<?php else:
echo $this->toolbar->toHtml();
echo $this->grid->toHtml();
endif; ?>
</form>